package com.game.basic;

import com.game.utils.ChangeUnitUtil;

/**
* @author oven:
* @version 创建时间：2012-11-6 下午2:04:27
* 
*/
public class BasicLength{
	protected float width;
	protected float height;
	
	public BasicLength(float width,float height){
		this.width=width;
		this.height=height;
	}
	
	public BasicLength(){
		
	}
	
	//获取真实的x
	public float getRealWidth(){
		return this.width;
	}
	//获取真实的y
	public float getRealHeight(){
		return this.height;
	}
	//设置真实的x值
	public void setRealWidth(float x) {
		this.width = x;
	}
	//设置真实的y值
	public void setRealHeight(float y) {
		this.height = y;
	}
	//调整真实的x
	public void addRealWidth(float x){
		this.width=this.width+x;
	}
	//调整真实的y
	public void addRealHeight(float y){
		this.height=this.height+y;
	}
	
	
	
	//获取转换比例后的x
	public float getWidth(){
		return ChangeUnitUtil.changeToScaleValueWidth(width);
	}
	//获取转换比例后的y
	public float getHeight(){
		return ChangeUnitUtil.changeToScaleValueHeight(height);
	}
	
	//把已转换比例的值设置为x的值
	public void setWidth(float widht){
		this.width=ChangeUnitUtil.changeToRealValueWidth(widht);
	}
	
	//把已转换比例的值设置为y的值
	public void setHeight(float height){
		this.height=ChangeUnitUtil.changeToRealValueHeight(height);
	}
	
	public void addWidth(float widht){
		this.width=this.width+ChangeUnitUtil.changeToRealValueWidth(width);
	}
	
	public void addHeight(float height){
		this.height=this.height+ChangeUnitUtil.changeToRealValueHeight(height);
	}
}

